
<html>
  
  <HEAD>
    
    <link rel="stylesheet" href="style/default.css" type="text/css">
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  
    <title>JAXB RI 2.1.4 fcs -- Developing JAXB RI Extensions
    </title>
    <link rel="alternate" href="https://jaxb.dev.java.net/servlets/ProjectNewsRSS" type="application/rss+xml">
  </HEAD>

  
  <BODY>
    <h1>
      <banner>
    Java
        <sup>
          <font size="-2">TM</font>
        </sup> Architecture for XML Binding
  
      </banner>
      <br>
      Developing JAXB RI Extensions 
    
    </h1>
    <center>
      <b>Implementation Version:</b> 2.1.4 fcs
      <br>
    </center>
    <table class="navbar" cellspacing="0">
      <tr>
        <td class="inactive">
          <a href="index.html">JAXB 2.0</a>
        </td>
        <td class="inactive">
          <a href="xjc.html">Tools</a>
        </td>
        <td class="inactive">
          <a href="jaxb-1_0.html">JAXB 1.0.x</a>
        </td>
        <td class="active">
          <a>JAXB RI Extensions</a>
        </td>
        <td class="inactive">
          <a href="community.html">JAXB Community</a>
        </td>
      </tr>
    </table>
    <div class="subnavbar">
      <ul>
        <li class="first">
          <a href="vendor.html">
            <span>Overview </span>
          </a>
        </li>
        <li>
          <a href="vendorProperties.html">
            <span>Runtime Properties </span>
          </a>
        </li>
        <li>
          <a href="vendorCustomizations.html">
            <span>XJC Customizations </span>
          </a>
        </li>
        <li>
          <a href="vendorSchemaLangs.html">
            <span>DTD </span>
          </a>
        </li>
        <li>
          <a href="developPlugins.html">
            <span class="active">Develop Plugins </span>
          </a>
        </li>
      </ul>
    </div>
    
    <header></header>
    
    
    <p>
      This document describes how to write an XJC plugin to extend the code generation of XJC.
    
    <p>
    
    
    <h2>What Can A Plugin Do?</h2>
    
    <p>
      An XJC plugin participates in the code generation from a schema. It can define its own customizations that users can use to control it, it can access the code that the JAXB RI generates, it can generate additional classes/methods/fields/annotations/comments, and it can also replace some of the pluggability points in the compilation process, such as XML name -&gt; Java name conversion.
    
    <p>
      As a show case of what a plugin can do, take a look at 
      <a href="https://jaxb2-commons.dev.java.net/">plugins hosted at JAXB2-commons</a>.
    
    
    
    
    
    <h3>Quick Start</h3>
    
    <p>
      To write a plugin, do the following simple steps.
    
    
    <ol>
      
      <li>Write a class, say, 
        <tt>org.acme.MyPlugin</tt> by extending 
        <tt>com.sun.tools.xjc.Plugin</tt>. See javadoc for how to implement methods.
      
      </li>
      <li>Write the name of your plugin class in a text file and put it as 
        <tt>/META-INF/services/com.sun.tools.xjc.Plugin</tt> in your jar file.
    
      </li>
    </ol>
    
    <p>
      Users can then use your plugins by declaring an XJC ant task with your jar files.
    

    <pre>
&lt;taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask"&gt;
  &lt;classpath&gt;
    &lt;fileset dir="jaxb-ri/lib" includes="*.jar" /&gt;
    &lt;fileset dir="your-plugin" includes="*.jar" /&gt;
  &lt;/classpath&gt;
&lt;/taskdef&gt;
</pre>
    
    
    <h3>Resources</h3>
    
    <p>
    	See 
      <a href="https://jaxb.dev.java.net/plugin.html">this page</a> for more detailed, up-to-date information. 
    
    
    <p>
      Although we will do our best to maintain the compatibility of the interfaces, it is still subject to change at this point.

    
    <hr>
    
    <div class="footer">
      $Revision: 1.3.4.2 $
      <br>
      $Date: 2006/09/06 21:11:06 $
    
    </div>
  

  </BODY>
</html>